#ifndef _AK_DEMUX_H_
#define _AK_DEMUX_H_

#include "ak_global.h"

/* demux media data type */
enum demux_data_type {
	DEMUX_DATA_UNKNOW = 0x00,
	DEMUX_DATA_VIDEO,
	DEMUX_DATA_AUDIO
};

struct demux_stream {
	unsigned char *data;	/* demux stream data */
	unsigned int len; 		/* demux stream len in bytes */
	unsigned long long ts;	/* demux timestamp(ms) */
	enum video_frame_type frame_type;	/* demux I or P frame */
};

/**
 * ak_demux_open - open dumxer lib
 * @file_path[IN]: media file path, including full name
 * @start[IN]: start flag
 * return: demux handle, NULL failed
 */
void* ak_demux_open(const char *file_path, int start);

/**
 * ak_demux_get_data - get data after demux
 * @demux_handle[IN]: opened demux handle
 * @type[IN]: demux type
 * return: the stream packet after demux, NULL failed
 */
struct demux_stream* ak_demux_get_data(void *demux_handle, 
						enum demux_data_type *type);

/**
 * ak_demux_free_data: free the demux resource
 * @video[IN]: the stream packet after demux
 * return: void
 */
void ak_demux_free_data(struct demux_stream *video);

/**
 * ak_demux_get_total_time: get media file's total time
 * @file_path[IN]: media file path, including full name
 * return: total time in ms
 */
int ak_demux_get_total_time(const char *file_path);

/**
 * ak_demux_close: close dumxer lib
 * @demux_handle[IN]: opened demux handle
 * return: void
 */
void ak_demux_close(void *demux_handle);

#endif
